<template lang="pug">
.back-mark-scenic(@click="back" v-if="$route.query.scenic")
  //- img(src="static/images/back.svg")
  i(class="el-icon-arrow-left")
  span 返回
</template>

<script>
import { mapGetters } from 'vuex'
export default {
  data() {
    return {
    }
  },
  computed: {
    ...mapGetters(['panoInfo']),
  },
  methods: {
    // 返回景点首页
    back() {
      if (this.panoInfo && this.panoInfo.group_scene_list && this.panoInfo.group_scene_list.length > 0) {
        console.log('255555-----------')
        let groupList = this.panoInfo.group_scene_list
        let sceneId = ''
        for (let i in groupList) {
          if (groupList[i].scenelist && groupList[i].scenelist.length > 0) {
            sceneId = groupList[i].scenelist[0].scene_id
            break
          }
        }
        // console.log(sceneId)
        if (sceneId) {
          this.$krp.switchEffect(sceneId)
          // this.$router.go(-1)
          this.$router.push('/panoview/' + this.$route.params.panoId)
          // setTimeout(() => {
          //   this.$router.push('/panoview/' + this.$route.params.panoId)
          // }, 1000)
        }
      } else {
        console.log('12-----')
        // this.$router.go(-1)
        this.$router.push('/panoview/' + this.$route.params.panoId)
        setTimeout(() => {
          window.location.reload()
        }, 1000)
      }
    }
  }
}
</script>

<style lang="stylus">
.back-mark-scenic
  position absolute
  left 20px
  top 20px
  z-index 11
  font-size 15px
  height 24px
  cursor pointer
  text-align center
  padding 0 10px
  overflow hidden
  color #fff
  img
    display inline-block
    vertical-align bottom
</style>
